<!--
 * @Descripttion: 
 * @version: 
 * @Author: siebe
 * @Date: 2022-02-18 15:45:23
 * @LastEditors: siebe
 * @LastEditTime: 2022-02-20 16:40:02
-->
{include file="public/header" /}
<form class="layui-form">
    <div class="layui-form-item">
        <input type="hidden" name="__token__" value="{:token()}" />
        <input type="hidden" class="layui-input" name="id" value="{$info['id']}">
        <label class="layui-form-label">配置名称</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="name" placeholder="请输入配置名称" value="{$info['name']}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">配置说明</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="content" placeholder="请输入配置说明" value="{$info['content']}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="type" placeholder="请输入配置类型" value="{$info['type']}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">值</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="value" placeholder="请输入配置值" value="{$info['value']}">
        </div>
    </div>
</form>
<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="button" class="layui-btn" onclick="save()">保存</button>
    </div>
</div>
<script type="text/javascript">
    layui.use(['form'],function(){
        form = layui.form;
        $ = layui.jquery
    });
    function save() {
            $.post("{$config.path}config/edit", $('form').serialize(), function (res) {
                if (res.error_code == 0) {
                    layer.msg(res.msg, { 'icon': 1 });
                    setTimeout(function () {
                        parent.window.location.reload();
                    }, 1000);
                } else {
                    layer.msg(res.msg, { 'icon': 2 });
                }
            }, 'json').error(function (res) {
                layer.msg(res.responseJSON.msg, { 'icon': 2 });
            });
        }
</script>
</body>
</html>